<template>
  <div class="product-item" v-if="detail.id>0">
    <div class="product-image">
      <img :src="detail.image" height="20">
    </div>
    <div class="product-right">
      <div class="product-name">
        <span v-text="detail.name"></span>
        <el-tag v-if="detail.score && detail.score>0" v-text="'商品评分: '+detail.score"></el-tag>
      </div>
      <div class="product-model-price">
        <div class="model-name">
          <span class="ovd_s"  v-text="detail.model" :title="detail.model" style="display: inline-block; height: 25px; line-height: 25px; position: relative; top: 2px; max-width: 200px; width: auto"></span>
        </div>
        <div class="product-price">
          <span class="price-font" v-text="ToMoney(detail.price)"></span>
          <span class="fuhao">×</span>

          <span v-if="typeof $props.updateNumsCallBack!=='function'" align="center" class="price-font nums" v-text="detail.nums"></span>
          <div style="display: inline-block; padding-right: 20px;">
            <el-input-number @change="changeNums" v-if="typeof $props.updateNumsCallBack==='function'" :max="$props.currProduct.nums" :min="0" v-model.number="detail.nums" controls-position="right" />
          </div>
          =
          <span class="price-font" v-text="'￥'+ToMoney((detail.nums*detail.price).toFixed(2)-0)"></span>
        </div>
        <div class="c"></div>
      </div>

    </div>
  </div>
</template>

<script>
export default {
  name: 'ProductItem',
  props:{
    updateNumsCallBack:Function,
    currProduct:Object
  },
  data:function () {
    return {
      id:0,
      detail:{}
    }
  },
  mounted () {
    this.detail=Object.assign({},this.$props.currProduct)
  },
  methods:{
    changeNums:function () {
      this.$props.updateNumsCallBack(this.detail.supplierProductStockId,this.detail.nums)
    }
  }
}
</script>

<style>
  *{
    -webkit-print-color-adjust: exact;
  }
  .product-item{ width: 100%; margin: 0px auto; margin-left: 2px; height: 55px; line-height: 25px; font-size: 12px; display: flex; text-align: left; background: #f1f1f1; margin-top: 3px; float: left}
  .product-item>.product-image{ width: 50px; height: 50px; overflow: hidden}
  .product-item>.product-image img{ width: 46px;  height: 46px; padding: 2px; border:solid 1px #EEEEEE;}
  .product-item>.product-right{ flex: 1; line-height: 25px; text-indent: 5px;}
  .product-item>.product-right>.product-name{}
  .product-item>.product-right>.product-model-price{ height: 25px; line-height: 25px;}
  .product-item>.product-right>.product-model-price>.model-name{  width: 30%; text-align: left; float: left; text-indent: 0px;}
  .product-item>.product-right>.product-model-price>.model-name>span{margin-left: 5px; display: inline-block; padding: 0px 5px; background: #f8c6a7; border-radius: 3px; }
  .product-item>.product-right>.product-model-price>.product-price{ width: 69%; float: left; text-align: right; padding-right: 5px;}
  .product-item>.product-right>.product-model-price>.product-price>span{ display: inline-block; width: 70px;}
  .product-item>.product-right>.product-model-price>.product-price>span.fuhao{ display: inline-block; width: 30px;}
  .product-item>.product-right>.product-model-price>.product-price>span.nums{ display: inline-block; width: 90px;}
  .product-item>.product-right>.product-model-price>.product-price div.el-input-number{ text-indent: 0px;}
  .price-font {
    color: #c61515;
    font-weight: bold;
  }


  .order-detail-page{ width: 1024px; margin: 0px auto;}
  #addressDetail{ height: auto; max-width: 230px;}
  .order-detail-page .product-item{  width: 1024px; height: 55px;line-height: 25px; font-size: 12px; display: flex; text-align: left; background: #f1f1f1; margin-top: 3px;}
  .order-detail-page .product-item>.product-image{ width: 50px; height: 50px;}
  .order-detail-page .product-item>.product-image img{ width: 46px;  height: 46px; padding: 2px; border:solid 1px #EEEEEE;}
  .order-detail-page .product-item>.product-right{ flex: 1; line-height: 25px; text-indent: 5px;}
  .order-detail-page .product-item>.product-right>.product-name{}
  .order-detail-page .product-item>.product-right>.product-model-price{ height: 25px; line-height: 25px;}
  .order-detail-page .product-item>.product-right>.product-model-price>.model-name{  float: left; text-indent: 0px; width: 30%;}
  .order-detail-page .product-item>.product-right>.product-model-price>.model-name>span{ margin-left: 5px; display: inline-block; padding: 0px 5px; background: #f8c6a7; border-radius: 3px;  float: left; text-indent: 0px;}
  .order-detail-page .product-item>.product-right>.product-model-price>.product-price{ width: 67%; float: left; text-align: right;}
  .order-detail-page .product-item>.product-right>.product-model-price>.product-price>span{ display: inline-block; width: 70px; }
  .order-detail-page .product-item>.product-right>.product-model-price>.product-price>span.fuhao{ display: inline-block; width: 30px;}
  .order-detail-page .product-item>.product-right>.product-model-price>.product-price>span.nums{ display: inline-block; width: 90px;}
  .order-detail-page .product-item>.product-right>.product-model-price>.product-price div.el-input-number{ text-indent: 0px;}
  .order-detail-page .price-font {
    color: #c61515;
    font-weight: bold;
  }
  .order-detail-page .price-box{
    width: 1000px; height: 55px;line-height: 25px; font-size: 12px;
  }
</style>
